<?php
include("odbc.php");
session_start();
if ($_POST['article_header_input'] && $_POST['article_text_input'] && strlen(trim($_POST['article_text_input'])) > 0) {
    mysql_query("INSERT INTO articles (user, header, text) VALUES ((SELECT id FROM users WHERE name='" . $_SESSION['cur_user'] . "'), '" . $_POST['article_header_input'] . "','" . $_POST['article_text_input'] . "');");
    if (mysql_error())
        die(mysql_error());
    header("Location: ./index.php");
    exit;
}
else
{
    if (!$_POST['article_header_input'])
        $article_header_input_err = 'Обязательное поле для заполнения';
    if (!$_POST['article_text_input'])
        $article_text_input_err = 'Обязательное поле для заполнения';
    $title_name = "Добавить статью";
    $page_file_name = 'addArticle_inc.php';
    $expected_user_privileg = 5;
    include('template.php');
}
?>